gh-140011: Delete importdl assertion that prevents importing embedded modules from packages#141605
Conversation
with this, test_embed fails with ``` Assertion failed: (PyUnicode_FindChar(name, '.', 0, PyUnicode_GetLength(name), -1) == -1), function _Py_ext_module_loader_info_init_for_builtin, file importdl.c, line 159. ```
with this, test_embed succeeds again
|
It was added in #118204 @ericsnowcurrently, do you remember if there was a reason for this assert? @itamaro: I'd be a bit more careful in Could you add a different containing package to the inittab? |
Can Regardless, I agree this is an awkward way to test this. I think it would make more sense to add a net new test case for this functionality, if we decide it's a desired functionality we don't want to regress. |
|
I'd say that as an embedder, you're probably in the best position both to test this, and to decide if it's desired functionality. Allowing submodules in inittab looks doable. (@brettcannon, do you have any thoughts on Allowing packages, on the other hand, might be worth more discussion -- that would probably need new API, since
It can! Not sure if it's meaningful to run it without the test package available, but I do use the CLI on its own when debugging. Anyway that's not the question to ask. More coupling bad, self-contained good :) |
|
thanks @encukou |
I think it's fine to add. I suspect it didn't have it just because the need never came up. |
This reverts commit 4949865.
covering both single-phase init and multi-phase init embedded extensions
|
@encukou I added new dedicated tests |
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
Looks good, thank you! |
|
Sorry, @itamaro and @encukou, I could not cleanly backport this to |
|
Sorry, @itamaro and @encukou, I could not cleanly backport this to |
…bedded modules from packages (pythonGH-141605) (cherry picked from commit 27f62eb)
|
GH-141986 is a backport of this pull request to the 3.14 branch. |
…bedded modules from packages (pythonGH-141605) (cherry picked from commit 27f62eb)
|
GH-141987 is a backport of this pull request to the 3.13 branch. |
…bedded modules from packages (pythonGH-141605)
…bedded modules from packages (pythonGH-141605)
I still don't know what's the context behind this assertion, just that I didn't see any issues from removing it.